 
<!--
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-03 14:41:20
 * @LastEditTime: 2023-10-20 09:22:49
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description:   :gridOps="gridOptions" allocation
-->
<template>
  <sc-VxeTable ref="xGrid" :tablecode="'storage_action_inventory_detail_finance'" :gridEvts="gridEvents"
    :url="api.storage.inventory.details">
  </sc-VxeTable>
  <SaveDialog v-if="dialog.save" ref="saveDialog" @success="handleSuccess" @closed="dialog.save = false"></SaveDialog>
</template>
<script>
export default {
  name: "storage_action_inventory_finance",
};
</script>
<script setup>

import { ref, nextTick } from "vue";
// , onMounted, reactive, ref
// const router = useRouter();
import SaveDialog from "./save";
import api from "@/api";
const dialog = ref({
  save: false,
});

const xGrid = ref({});
const saveDialog = ref({});
const handleSuccess = () => {
  xGrid.value.refresh();
};
const edit = (data, id) => {
  dialog.value.save = true;
  nextTick(() => {
    saveDialog.value.setData(data, id);
    saveDialog.value.open("edit");
  });
}
const gridEvents = {
  cellDblclick: function ({ row }) {
    edit(row.main, row.id)
    // gridEvents.editItem();
  },
  addItem: function () {
    dialog.value.save = true;
    nextTick(() => {
      saveDialog.value.open();
    });
  },

  editItem: function ({ button }) {
    edit(button.selectRecords[0].main, button.selectRecords[0].id)
  },
};
</script>
